<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<script src="${ctxStatic}/jquery-validation/1.11.1/lib/jquery-1.9.0.js" type="text/javascript"></script>
<script src="${ctxStatic}/jquery-validation/1.11.1/lib/jquery.form.js" type="text/javascript"></script>
<html>
<head>
	<title>批量导入</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			var msg = "${msg}";
			if(msg){
				alert(msg);
			}
		});
		
		function upLoad()
		{
			var batchFile = $("#batchFile").val();
			if(!batchFile)
			{
				alert("您还没有选择文件，请先选择文件。");
				return;
			}
			if(batchFile.indexOf(".") < 0 || batchFile.split(".")[1] != "xlsx")
			{
				alert("您选择的文件格式错误，文件以下载的模板为准。");
				return;
			}
			if(confirm("确认要导入吗？"))
			{
				$("#tip").show();
				document.forms[0].submit();
			}
		}
		
		function downLoad()
		{
			$("#download")[0].src="${ctx}/ems/award/downLoadTemplate";	
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/cms/comment/">批量导入</a></li>
	</ul>
	<form id="fileForm" method="post" action="${ctx}/ems/award/import" enctype="multipart/form-data">
	<div style="margin-left: 100px;">
		</br></br>
		<font size="3">请选择批量导入的文件：</font>
		<input type="file" id="batchFile" name="batchFile">
		</br>
		</br>
		<input type="button" class="btn btn-primary" value="模板下载" onclick="downLoad();">
		&nbsp;&nbsp;&nbsp;
		<input type="button" class="btn btn-primary" value="上传" onclick="upLoad();">
	</div>
	</form>
	
	<div style="margin-left: 100px;"> 
		<font color="red" style="font-weight: bold;display: none;" id="tip">
			<img src='${ctxStatic}/images/loading.gif'/>正在上传，请稍后...
		</font>
	</div>
	
	<div style="margin-left: 100px;">
		<font color="red">
			注意： </br>
				 1，导入前，请先下载模板，根据模板的格式填写数据，填写完毕后再做导入。</br>
				 2，模板中任何一行出现必填数据为空时，该行将不做处理。
		</font>
	</div>
	<iframe id="download" src="" style="display: none" />
</body>
</html>
